﻿@model S4Store.Models.AfterSaleReport.AfterSaleReportServiceAdvisorModel
@{
    Layout = null;

    //公式部分
    //List<dynamic> _5K保养完成率 = new List<dynamic>();
    //List<dynamic> _10K保养完成率 = new List<dynamic>();
    List<dynamic> 常态维修产值 = new List<dynamic>();
    string carbrandname = string.Empty;
    if(Model.SADayDatas.Count>0)
    {
        carbrandname = Model.SADayDatas[0].Employee.Name;
    }
    for (var dt = Model.BarModel.Start ?? DateTime.Now.AddMonths(-6); dt <= Model.BarModel.End; dt = dt.AddMonths(1))
    {

        //_5K保养完成率.Add(new
        //{
        //    时间 = dt,
        //    _5K保养完成率目标 = 100,
        //    _5K保养完成率实际 = Model._5K保养完成率(Model.BarModel.SearchSellerId ?? 0, dt.Year, dt.Month)
        //});

        //_10K保养完成率.Add(new
        //{
        //    时间 = dt,
        //    _10K保养完成率目标 = 100,
        //    _10K保养完成率实际 = Model._10K保养完成率(Model.BarModel.SearchSellerId ?? 0, dt.Year, dt.Month),
        //});

        常态维修产值.Add(new
        {
            时间 = dt,
            维修产值 = Model.常态维修产值(Model.BarModel.SearchSellerId ?? 0, dt.Year, dt.Month)
        });
        
    }
    
    //图标部分
    //S4Store.Models.Chart.Line ChartModel = new S4Store.Models.Chart.Line();
    //ChartModel.Colors = new List<string> { S4Store.Models.Chart.Color.Green, S4Store.Models.Chart.Color.Blue };
    //ChartModel.YAxis = "5K保养完成率";

    //foreach (var item in _5K保养完成率.GroupBy(o => o.时间))
    //{
    //    ChartModel.XAxis.Add(item.Key.Year + "-" + item.Key.Month);
    //}
    //S4Store.Models.Chart.ChartSeries series = new S4Store.Models.Chart.ChartSeries();
    //series.Name = "5K保养完成率目标";
    //foreach (var item in _5K保养完成率)
    //{
    //    series.Data.Add(item._5K保养完成率目标);
    //}
    //ChartModel.Serieses.Add(series);
    
    //S4Store.Models.Chart.ChartSeries series1 = new S4Store.Models.Chart.ChartSeries();
    //series1.Name = "实际5K保养完成率";
    //foreach (var item in _5K保养完成率)
    //{
    //    series1.Data.Add(item._5K保养完成率实际);
    //}
    //ChartModel.Serieses.Add(series1);


    ////2
    //S4Store.Models.Chart.Line ChartModel1 = new S4Store.Models.Chart.Line();
    //ChartModel1.Colors = new List<string> { S4Store.Models.Chart.Color.Green, S4Store.Models.Chart.Color.Blue };
    //ChartModel1.IsRate = false;
    //ChartModel1.YAxis = "10K保养完成率";

    //foreach (var item in _10K保养完成率.GroupBy(o => o.时间))
    //{
    //    ChartModel1.XAxis.Add(item.Key.Year + "-" + item.Key.Month);
    //}

    //S4Store.Models.Chart.ChartSeries series11 = new S4Store.Models.Chart.ChartSeries();
    //series11.Name = "10K保养完成率目标";
    //foreach (var item in _10K保养完成率)
    //{
    //    series11.Data.Add(item._10K保养完成率目标);
    //}
    //ChartModel1.Serieses.Add(series11);

    //S4Store.Models.Chart.ChartSeries series12 = new S4Store.Models.Chart.ChartSeries();
    //series12.Name = "10K保养完成率实际";
    //foreach (var item in _10K保养完成率)
    //{
    //    series12.Data.Add(item._10K保养完成率实际);
    //}
    //ChartModel1.Serieses.Add(series12);



    
    
    //3
    S4Store.Models.Chart.Line ChartModel3 = new S4Store.Models.Chart.Line();
    ChartModel3.IsRate = false;
    ChartModel3.Colors = new List<string> { S4Store.Models.Chart.Color.Green, S4Store.Models.Chart.Color.Blue };
    ChartModel3.YAxis = "常态维修产值";

    //foreach (var item in 维修入场台次完成率.GroupBy(o => o.时间))
    //{
    //    ChartModel3.XAxis.Add(item.Key.Year + "-" + item.Key.Month);
    //}
    //S4Store.Models.Chart.ChartSeries series31 = new S4Store.Models.Chart.ChartSeries();
    //series31.Name = "维修入场台次完成率目标";
    //foreach (var item in 维修入场台次完成率)
    //{
    //    series31.Data.Add(item.维修入场台次完成率目标);
    //}
    //ChartModel3.Serieses.Add(series31);

    S4Store.Models.Chart.ChartSeries series32 = new S4Store.Models.Chart.ChartSeries();
    series32.Name = "常态维修产值";
    foreach (var item in 常态维修产值)
    {
        series32.Data.Add(item.维修产值);
    }
    ChartModel3.Serieses.Add(series32);

<div style="height:100%; overflow:auto">

@Html.Action("ReportBar", "Common", Model.BarModel)

<div class="pagetitle">@(carbrandname)维修产值过程KPI历史数据查询</div>

@*<p class="ft14 center pd55">5K保养完成率</p>
@Html.Partial("../Chart/Line", ChartModel)
<p class="ft14 center pd55">10K保养完成率</p>
@Html.Partial("../Chart/Line", ChartModel1)*@

<p class="ft14 center pd55">常态维修产值</p>
@Html.Partial("../Chart/Line", ChartModel3)
</div>
}